﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Camc.Quality.Migrations
{
    public partial class add_workUpde : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_BusinessApplications_ModifyManages_ModifyManagesId",
                table: "BusinessApplications");

            migrationBuilder.DropForeignKey(
                name: "FK_BusinessApplications_BomChangeContents_bomChangeContentId",
                table: "BusinessApplications");

            migrationBuilder.DropForeignKey(
                name: "FK_BusinessApplications_BomDesignDetails_bomDesignDetailId",
                table: "BusinessApplications");

            migrationBuilder.DropIndex(
                name: "IX_BusinessApplications_ModifyManagesId",
                table: "BusinessApplications");

            migrationBuilder.DropIndex(
                name: "IX_BusinessApplications_bomChangeContentId",
                table: "BusinessApplications");

            migrationBuilder.DropIndex(
                name: "IX_BusinessApplications_bomDesignDetailId",
                table: "BusinessApplications");

            migrationBuilder.DropColumn(
                name: "ModifyManagesId",
                table: "BusinessApplications");

            migrationBuilder.DropColumn(
                name: "bomChangeContentId",
                table: "BusinessApplications");

            migrationBuilder.DropColumn(
                name: "bomDesignDetailId",
                table: "BusinessApplications");

            migrationBuilder.AddColumn<string>(
                name: "Remark",
                table: "WorkAuditors",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Result",
                table: "WorkAuditors",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "BusinessId",
                table: "ModifyManages",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "ApplicationDate",
                table: "BusinessApplications",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "BusinessNumber",
                table: "BusinessApplications",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Remark",
                table: "WorkAuditors");

            migrationBuilder.DropColumn(
                name: "Result",
                table: "WorkAuditors");

            migrationBuilder.DropColumn(
                name: "BusinessId",
                table: "ModifyManages");

            migrationBuilder.DropColumn(
                name: "ApplicationDate",
                table: "BusinessApplications");

            migrationBuilder.DropColumn(
                name: "BusinessNumber",
                table: "BusinessApplications");

            migrationBuilder.AddColumn<Guid>(
                name: "ModifyManagesId",
                table: "BusinessApplications",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "bomChangeContentId",
                table: "BusinessApplications",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "bomDesignDetailId",
                table: "BusinessApplications",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_BusinessApplications_ModifyManagesId",
                table: "BusinessApplications",
                column: "ModifyManagesId");

            migrationBuilder.CreateIndex(
                name: "IX_BusinessApplications_bomChangeContentId",
                table: "BusinessApplications",
                column: "bomChangeContentId");

            migrationBuilder.CreateIndex(
                name: "IX_BusinessApplications_bomDesignDetailId",
                table: "BusinessApplications",
                column: "bomDesignDetailId");

            migrationBuilder.AddForeignKey(
                name: "FK_BusinessApplications_ModifyManages_ModifyManagesId",
                table: "BusinessApplications",
                column: "ModifyManagesId",
                principalTable: "ModifyManages",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_BusinessApplications_BomChangeContents_bomChangeContentId",
                table: "BusinessApplications",
                column: "bomChangeContentId",
                principalTable: "BomChangeContents",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_BusinessApplications_BomDesignDetails_bomDesignDetailId",
                table: "BusinessApplications",
                column: "bomDesignDetailId",
                principalTable: "BomDesignDetails",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
